#include<iostream>
#include<string.h>

using namespace std;

void changeTenToSixteen(long long ten,char * sixteen);

int main(void)
{
    long long ten=0;
    char sixteen[41];
    cin >> ten;
    memset(sixteen,0,sizeof(sixteen));
    changeTenToSixteen(ten,sixteen);
    cout << sixteen;
    return 0;
}

void changeTenToSixteen(long long ten,char * sixteen)
{
    char now,temp;
    int length;
    temp = now = 0;
    length = 0;
    if(ten==0) 
    {
    	*sixteen='0';
    	++sixteen='\0';
    	return;
    }
    while(ten != 0)
    {
        now = ten % 16;
        length++;
        if(now >= 0 && now <= 9)  *sixteen='0' + now;
        if(now >= 10 && now <= 15) *sixteen='A'+ now -10;
        ten = ten/16;
        sixteen++;
    }
    *sixteen='\0';
    sixteen--;
    for(int i=0; i < length/2; i++)
    {
        temp = *(sixteen-i);
        *(sixteen-i)=*(sixteen-length+1+i);
        *(sixteen-length+1+i)=temp;
    }
}
